import 'package:flutter/material.dart';

import 'package:get/get.dart';
import '../../../services/screebAdapter.dart';
import '../controllers/cart_controller.dart';

class CartItemNum extends GetView {
  CartController controller = Get.find();
  final Map cartItem;
  CartItemNum(this.cartItem, {super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: ScreenAdapter.width(244),
      height: ScreenAdapter.height(60),
      decoration: BoxDecoration(
          border:
              Border.all(width: ScreenAdapter.width(2), color: Colors.black12)),
      child: Row(
        children: [
          InkWell(
            onTap: () {
              controller.decCartNum(cartItem);
            },
            child: Container(
              alignment: Alignment.center,
              width: ScreenAdapter.width(80),
              height: ScreenAdapter.height(60),
              child: const Text('-'),
            ),
          ),
          Container(
            alignment: Alignment.center,
            width: ScreenAdapter.width(80),
            height: ScreenAdapter.height(60),
            child: Text('${cartItem["count"]}'),
          ),
          InkWell(
            onTap: () {
              controller.incCartNum(cartItem);
            },
            child: Container(
              alignment: Alignment.center,
              width: ScreenAdapter.width(80),
              height: ScreenAdapter.height(60),
              child: const Text('+'),
            ),
          ),
        ],
      ),
    );
  }
}
